#!/bin/bash

# Compression script
# Creates data.tar, fitting.tar, and origin.tar

cd /home/loongson/tzc_cs/project/user/build/ || {
    echo "Error: Cannot access target directory"
    exit 1
}

for folder in data fitting origin; do
    if [ ! -d "$folder" ]; then
        echo "Warning: $folder not found - skipping"
        continue
    fi
    
    echo "Compressing $folder to $folder.tar..."
    tar -cvf "$folder.tar" "$folder"
    
    if [ $? -eq 0 ]; then
        echo "Created: $folder.tar"
    else
        echo "Failed to compress $folder"
    fi
done

echo "Compression complete"